{% extends "common/base.side.html" %}

{% block title %}
    List Blog
{% endblock %}

{% block rcontent %}
    <div class="btn-toolbar">
        <div class="btn-group">
            {% url "addblogurl" as theaddblogurl %}
            <a class="btn btn-default {% if request.path == theaddblogurl %} active {% endif %}"
               href={{ theaddblogurl }}><span class="glyphicon glyphicon-edit"></span>新增博客</a>
            {% url "bloglisturl" as thelistblogurl %}
            <a class="btn btn-default {% if request.path == thelistblogurl %} active {% endif %}"
               href={{ thelistblogurl }}><span class="glyphicon glyphicon-list"></span>博客列表</a>
        </div>
    </div>

    <hr/>

    <table class="table table-hover table-striped  table-bordered table-condensed">
        <tr>
            <th>姓名</th>
            <th>博客地址</th>
            <th>评分</th>
            <th>评语</th>
            <th>操作</th>
        </tr>

        {% for i in lPage %}
            <tr style="font-size: 13px;">
                <td>{{ i.author }}</td>
                <td>{{ i.url }}</td>
                <td>{{ i.get_grade_display|default_if_none:"暂无评分" }}</td>
                <td>{{ i.comment|default_if_none:"暂无评语" }}</td>
                <td class="host_buttom">
                    <a href={% url "editblogurl" i.id %} onclick="return confirm('是否确认编辑？')">
                    <span class="glyphicon glyphicon-edit btn-xs"></span></a>
                    {% if request.user.username == 'admin' %}
                    <a href={% url "commentblogurl" i.id %} onclick="return confirm('是否确认添加评分？')">
                        <span class="glyphicon glyphicon-comment btn-xs"></span></a>
                    {% endif %}
                    <a href={% url "blogdeleteurl" i.id %} onclick="return confirm('是否确认删除？')">
                    <span class="glyphicon glyphicon-trash btn-xs"></span></a>
                </td>
            </tr>
        {% endfor %}

    </table>

    {% include "common/paginator.html" %}
{% endblock %}
